﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 获取屏幕与任务栏信息
{
    class Program
    {
        static void Main(string[] args)
        {
            Rectangle taskbarRect = Screen.PrimaryScreen.WorkingArea;

            Thread th = new Thread(ThreadFun);
            th.IsBackground = true;
            th.Start();

            while (true) {
                Thread.Sleep(100);
            }
        }


        static void ThreadFun() {
            while (true) {
                Rectangle taskbarRect = Screen.PrimaryScreen.WorkingArea;

                Console.WriteLine("//==================================================================//");

                Console.WriteLine("Screen.PrimaryScreen.Bounds信息：" );
                Console.WriteLine("(X,Y)-> " + Screen.PrimaryScreen.Bounds.X + "," + Screen.PrimaryScreen.Bounds.Y);
                Console.WriteLine("(Width,Height)-> " + Screen.PrimaryScreen.Bounds.Width + "," + Screen.PrimaryScreen.Bounds.Height);
                Console.WriteLine("//------------------------------------------------------------------//");
                Console.WriteLine("Screen.PrimaryScreen.WorkingArea信息：");
                Console.WriteLine("(X,Y)-> " + Screen.PrimaryScreen.WorkingArea.X + "," + Screen.PrimaryScreen.WorkingArea.Y);
                Console.WriteLine("(Width,Height)-> " + Screen.PrimaryScreen.WorkingArea.Width + "," + Screen.PrimaryScreen.WorkingArea.Height);

                Console.WriteLine("//==================================================================//");
                
                Thread.Sleep(2000);
            }
        }

    }
}
